Interface sjl.Function0
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Interface sjl.Function0

public interface Function0
extends Object
Defines the interface for function object that does not take any parameters. A function object is an object that can understand the perform() message. Function objects are used by many of the algorithms, ex: generate. You must implement the actual function object with code like this:
public class GenerateString implements Function0 {
    private cnt = 1;
    public Object perform() {
        return new String("Initial value : " + n++);
    }
}
This class will, when used with the generate function, fill the container with the strings:
     Initial value : 1
     Initial value : 2
     Initial value : 3
     ...

Copyright © 1996 Finn Bock

See Also:
Function1, Function2

Method Index

 o perform()
This method is executed for each call to the function object.

Methods

 o perform
  public abstract Object perform()
This method is executed for each call to the function object.

All Packages  Class Hierarchy  This Package  Previous  Next  Index